{
  "properties" : { },
  "id" : "59b593090d0c473f8615c96a462054ef",
  "script" : null,
  "groupId" : "5b4c0f1fcedc4bfbbf84bb3791e01399",
  "name" : "批量绑定",
  "createTime" : 1727070936954,
  "updateTime" : 1726304750815,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "batchBind",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\n    \"targetId\": \"690,724\",\n    \"ruleId\": \"100003\"\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": true\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }
}
================================
import redis

    alarmRule1 = db.selectOne(""" select * from alarm_rule where id = #{body.ruleId} """)
    metric = db.selectOne(""" select code from alarm_metric where 1 = 1
            <if test="alarmRule1.ruleMetricId != null and alarmRule1.ruleMetricId != ''">
                and id = #{alarmRule1.ruleMetricId}
            </if>
        """)
    if (metric != null) {
        redis.delete("ndmp-alarm-rule:" + metric.code)
    }
    if (!Objects.equals(body.targetId, "")) {
        split = body.targetId.split(",");
        targetList = new ArrayList()
        for (item in split) {
            var entity = {
                "rule_id":body.ruleId,
                "target_id":item
            }
            db.table('alarm_rule_target').primary('id').save(entity)  
        }
        return true
    }
    return false